﻿using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;

namespace BUS
{
    public class tbHTThanhToanBus
    {
        public static void Insert_HTThanhtoan(tbHTThanhToan htthanhtoan)
        {
            tbHTThanhToanDAL htthanhtoanDAL = new tbHTThanhToanDAL();
            htthanhtoanDAL.Insert(htthanhtoan);
        }
        public static void Update_HTThanhtoan(tbHTThanhToan htthanhtoan)
        {
            tbHTThanhToanDAL htthanhtoanDAL = new tbHTThanhToanDAL();
            htthanhtoanDAL.Update(htthanhtoan);
        }
        public static void Delete_HTThanhtoan(int Id)
        {
            tbHTThanhToanDAL htthanhtoanDAL = new tbHTThanhToanDAL();
            htthanhtoanDAL.Delete(Id);
        }
        public static tbHTThanhToan.tbHTThanhToanCollection Get(string Where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {

            tbHTThanhToanDAL htthanhtoanDAL = new tbHTThanhToanDAL();
            return (htthanhtoanDAL.Get(Where, pageindex, pagesize, orderby, orderdirection, out total));
        }
        public static tbHTThanhToan.tbHTThanhToanCollection GetAll()
        {
            int total = 0;
            tbHTThanhToanDAL htthanhtoanDAL = new tbHTThanhToanDAL();
            return htthanhtoanDAL.Get("Where 1=1", 0, 0, tbHTThanhToan.tbHTThanhToanColumns.IDHinhThuc.ToString(), "ASC", out total);
        }
        public static tbHTThanhToan GetByID(int iD)
        {
            int total = 0;
            tbHTThanhToanDAL htthanhtoanDAL = new tbHTThanhToanDAL();
            tbHTThanhToan.tbHTThanhToanCollection htthanhtoancollection = htthanhtoanDAL.Get("where " + tbHTThanhToan.tbHTThanhToanColumns.IDHinhThuc.ToString() + "=" + iD.ToString(), 0, 0, tbHTThanhToan.tbHTThanhToanColumns.IDHinhThuc.ToString(), "ASC", out total);
            if (htthanhtoancollection.Count > 0)
                return htthanhtoancollection[0];
            return null;
        }

    } 
}
